﻿<cfsilent>
	<cfscript>
		
		dictAdvice = getProperty("serviceFactory").getBean("senateDictionaryAdvice");
		
		depId = event.getArg("DepID", event.getArg("InstituteID"));
		courseId = event.getArg("CID", event.getArg("CourseID"));
		
		sql = "SELECT  a.institute_id,
					   a.institute_name 
				FROM t_institute a  
				WHERE a.institute_id = :depId ";
		queryObj = new Query( datasource=application.dnsSlave ); 
		queryObj.addParam( name="depId", value=depId, cfsqltype="cf_sql_varchar" );
		rs_department = queryObj.execute( sql=sql ).getResult();
		sql = "SELECT  a.course_name,a.cid,
					   a.course_credit,a.period_theory,
					   a.period_practice,a.period_computer,
					   a.course_code,a.mark_mode,
					   a.resit_policy,a.abandon,
					   a.period_week,a.institute_id,
					   a.cat_id,a.course_english,
					   a.intro,a.reference_books,
					   a.prop_id 
				FROM t_course a 
				WHERE a.cid = :courseId ";
		queryObj = new Query( datasource=application.dnsSlave ); 
		queryObj.addParam( name="courseId", value=courseId, cfsqltype="cf_sql_varchar" );
		rs_course = queryObj.execute( sql=sql ).getResult();
						
		sql = "SELECT  a.institute_id,
					   a.institute_name 
				FROM t_institute a  
				WHERE a.classification = '1' 
					  OR 
					  a.classification = '3' 
				ORDER BY a.institute_name ";
		queryObj = new Query( datasource=application.dnsSlave ); 
		rs_host = queryObj.execute( sql=sql ).getResult();
		
		sql = "SELECT a.cat_id,a.cat_name 
				FROM t_course_catalog a  
				ORDER BY a.cat_id ";
		queryObj = new Query( datasource=application.dnsSlave ); 
		rs_cat = queryObj.execute( sql=sql ).getResult();
		
		event.setArg("pageTitle", "教学运行基础数据 - 课程库维护 -" & rs_course.course_name);

		targetArgs = structNew();
		structInsert(targetArgs, "DepID", rs_department.institute_id, true);

		currentTab = event.getArg("TabID", "labCreate");

	</cfscript>
</cfsilent>

<div id="headArea">
	<div class="uiHeader uiHeaderWithImage ptm">
		<div class="clearfix uiHeaderTop">
			<div class="uiHeaderActions rfloat">
				<a class="uiButton" href="<cfoutput>#buildURL('courseByDepartment', targetArgs)#</cfoutput>"><i class="mrs img btnPublish"></i><span class="uiButtonText"><cfoutput>#rs_department.institute_name#</cfoutput>课程</span></a>
			</div>
			<div>
				<h2 class="uiHeaderTitle">
					<i class="uiHeaderImage img icon16x16 course"></i><cfoutput>#rs_course.course_name#</cfoutput>
				</h2>
			</div>
		</div>
	</div>
</div>

<div class="UIElement">
	<ul class="senateFirstPage">
		<li>
			<div class="clearfix" id="summary">
				<div class="UItab">
					<div class="tabLables">
						<span <cfif currentTab eq "labCreate">class="active"</cfif> id="labCreate" tabTarget="Create">课程基本信息</span>
						<span <cfif currentTab eq "labRemove">class="active"</cfif> id="labRemove" tabTarget="Remove">删除课程</span>
					</div>
				</div>
				<script language="javascript" type="text/javascript">
					//<![CDATA[
					<!--
					$(document).ready(function() {
						
						/* init Tab */
						$("div.tabContent").hide();
						$("div#" + $("div.tabLables span.active").attr("tabTarget")).show();
						
						$("div.tabLables > span").click(function(){
							var $targetID = $(this).attr("tabTarget");
							
							$("div.tabLables span").removeClass("active");
							$(this).addClass("active");
							
							$("div.tabContent").not('[id="' + $targetID + '"]').hide();
							$("div.tabContent#" + $targetID).show();
						});
						
					});
					// -->
					//]]>
				</script>
				
				<div id="Create" class="tabContent">
					
					<cfif event.getArg("courseExistsID") neq "">
						
						<div class="systemNotice">
							<h3><span class="img icon16x16 info"></span>《<cfoutput>#event.getArg('CourseName')#</cfoutput>》在开课学院有重复记录</h3>
							<p>您当前要求录入的课程《<cfoutput>#event.getArg('CourseName')#</cfoutput>》在课程库的存在已有记录. 任课单位在课程设置时, 必须保证课程名称唯一性.</p>
						</div>
						
					</cfif>
					
					<form id="formEdit" onSubmit="javascript:return processVerfiyForm('formEdit');" class="formWrapper" method="post" action="<cfoutput>#buildURL('courseUpdateDo')#</cfoutput>">
						
						<input type="hidden" name="CourseID" value="<cfoutput>#rs_course.cid#</cfoutput>" />
						
						<div class="label">
							<span class="req">*</span><b>课程</b>
							<input name="CourseName" id="CourseName" type="text" class="typeTextShort" verification="required" maxlength="30" value="<cfoutput>#event.getArg('CourseName', rs_course.course_name)#</cfoutput>" />
						</div>
						
						<div class="label">
							<span class="req">*</span><b>学分</b>
							<input name="Credit" id="Credit" type="text" class="typeTinyInt" verification="double" maxlength="4" value="<cfoutput>#event.getArg('Credit', rs_course.course_credit)#</cfoutput>" />
						</div>
						
						<div class="label">
							<span class="req">*</span><b>学时分布</b>
							理论学时<input name="PeriodTheory" id="PeriodTheory" type="text" class="typeTinyInt" verification="integer" maxlength="4" value="<cfoutput>#event.getArg('PeriodTheory', rs_course.period_theory)#</cfoutput>" />
							实践学时<input name="PeriodPractice" id="PeriodPractice" type="text" class="typeTinyInt" verification="integer" maxlength="4" value="<cfoutput>#event.getArg('PeriodPractice', rs_course.period_practice)#</cfoutput>" />
							实验学时<input name="PeriodComputer" id="PeriodComputer" type="text" class="typeTinyInt" verification="integer" maxlength="4" value="<cfoutput>#event.getArg('PeriodComputer', rs_course.period_computer)#</cfoutput>" />
						</div>
						
						<div class="label">
							<span class="req">*</span><b>课程号</b>
							<input name="CourseCode" id="CourseCode" type="text" class="typeCode" verification="required" maxlength="20" value="<cfoutput>#event.getArg('CourseCode', rs_course.course_code)#</cfoutput>" />
							<p class="notice">如果学校对于课程有自己的编码规范, 您可以在这里手工指定现有课程的编码</p>
						</div>
						
						<div class="label">
							<b>计分模式</b>
							<select name="MarkMode">
								<option <cfif event.getArg('MarkMode', rs_course.mark_mode) eq '0'>selected="selected"</cfif> value="0">百分制</option>
								<option <cfif event.getArg('MarkMode', rs_course.mark_mode) eq '4'>selected="selected"</cfif> value="4">五级制（优、良好、中、及格、不及格）</option>
                                        <option <cfif event.getArg('MarkMode', rs_course.mark_mode) eq '2'>selected="selected"</cfif> value="2">两级制（合格、不合格）</option>
							</select>
						</div>
						
						<hr/>
						
						<div class="label">
							<b>安排补考</b>
							<input name="ResitPolicy" type="radio" class="typeRadio" value="1" <cfif event.getArg('ResitPolicy', rs_course.resit_policy) eq '1'>checked="checked"</cfif> />是
							<input name="ResitPolicy" type="radio" class="typeRadio" value="0" <cfif event.getArg('ResitPolicy', rs_course.resit_policy) eq '0'>checked="checked"</cfif>/>否
						</div>
						
						<div class="label">
							<b>已停止开课</b>
							<input name="Abandon" type="radio" class="typeRadio" value="1" <cfif event.getArg('Abandon', rs_course.abandon) eq '1'>checked="checked"</cfif> />是
							<input name="Abandon" type="radio" class="typeRadio" value="0" <cfif event.getArg('Abandon', rs_course.abandon) eq '0'>checked="checked"</cfif>/>否
						</div>
                              
                              <div class="label">
							<b>课程类别</b>
							<input name="courseProp" type="radio" class="typeRadio" value="1" <cfif event.getArg('propId', rs_course.prop_id) eq '1'>checked="checked"</cfif> />必修
							<input name="courseProp" type="radio" class="typeRadio" value="2" <cfif event.getArg('propId', rs_course.prop_id) eq '2'>checked="checked"</cfif>/>限选
						</div>
						
						<hr/>
						
						<div class="label">
							<b>排课周学时</b>
							<select name="PeriodPerWeek">
								<option <cfif event.getArg('PeriodPerWeek', rs_course.period_week) eq 0>selected="selected"</cfif> value="0">不排课</option>
                                        <option <cfif event.getArg('PeriodPerWeek', rs_course.period_week) eq 1>selected="selected"</cfif> value="1">每周一次课，每次1小节</option>
								<option <cfif event.getArg('PeriodPerWeek', rs_course.period_week) eq 2>selected="selected"</cfif> value="2">每周一次课, 安排2小节</option>
								<option <cfif event.getArg('PeriodPerWeek', rs_course.period_week) eq 3>selected="selected"</cfif> value="3">每周一次课, 安排3小节</option>
								<option <cfif event.getArg('PeriodPerWeek', rs_course.period_week) eq 4>selected="selected"</cfif> value="4">每周两次课, 每次2小节 或 每周一次课, 连续4小节</option>
								<option <cfif event.getArg('PeriodPerWeek', rs_course.period_week) eq 5>selected="selected"</cfif> value="5">每周两次课, 一次2小节,一次3小节 或 每周一次课, 连续5小节</option>
								<option <cfif event.getArg('PeriodPerWeek', rs_course.period_week) eq 6>selected="selected"</cfif> value="6">每周三次课, 每次2小节 或 每周两次课, 每次3小节 或 一次4小节, 一次3小节</option>
								<option <cfif event.getArg('PeriodPerWeek', rs_course.period_week) eq 8>selected="selected"</cfif> value="8">每周四次课, 每次2小节 或 每周三次课, 两次3小节, 一次2小节 或 每周两次课,每次4小节</option>
								<option <cfif event.getArg('PeriodPerWeek', rs_course.period_week) eq 10>selected="selected"</cfif> value="10">每周五次课, 每次2小节 或 每周四次课, 两次3小节, 两次2小节</option>
                                        <option <cfif event.getArg('PeriodPerWeek', rs_course.period_week) eq 12>selected="selected"</cfif> value="12">每周六次课, 每次2小节</option>
								<option <cfif event.getArg('PeriodPerWeek', rs_course.period_week) eq 16>selected="selected"</cfif> value="16">每周四次课，每次4小节</option>
							</select>
						</div>

						<div class="label">
							<b>任课单位</b>
							<select name="InstituteID">
                                <cfloop query="rs_host" >
									<option <cfif rs_course.institute_id eq rs_host.institute_id>selected="selected"</cfif> value="<cfoutput>#rs_host.institute_id#</cfoutput>"><cfoutput>#rs_host.institute_name#</cfoutput></option>
								</cfloop>
							</select>
						</div>
						
						<div class="label">
							<b>课程类别</b>
							<select name="CatID">
                                <cfloop query="rs_cat" >
									<cfif rs_cat.cat_id eq '00'>
                                             	<option <cfif event.getArg('CatID', rs_course.cat_id) eq rs_cat.cat_id>selected="selected"</cfif> value="<cfoutput>#rs_cat.cat_id#</cfoutput>"><cfoutput>#rs_cat.cat_name#</cfoutput></option>
                                                 </cfif>
								</cfloop>
							</select>
						</div>
						
						<hr/>
						
						<div class="label">
							<b>英文名称</b>
							<input name="CourseEnglish" id="CourseEnglish" type="text" class="typeText typeEnglish" maxlength="180" value="<cfoutput>#event.getArg('CourseEnglish', rs_course.course_english)#</cfoutput>" />
						</div>
						
						<div class="label">
							<b>课程介绍</b>
							<textarea name="Intro" id="Intro"><cfoutput>#event.getArg('Intro', rs_course.intro)#</cfoutput></textarea>
						</div>
						
						<div class="label">
							<b>参考书</b>
							<textarea name="ReferenceBooks" id="ReferenceBooks"><cfoutput>#event.getArg('ReferenceBooks', rs_course.reference_books)#</cfoutput></textarea>
						</div>
						
						<hr/>
						
						<div class="lable">
							<input class="button" type="submit" value="更新" />
							<input class="button" type="reset" value="重设表格" />
						</div>
						
					</form>
					
				</div>
				
				<div id="Remove" class="tabContent">
					
					<div class="systemNotice">
						<h3><span class="img icon16x16 info"></span>删除课程信息</h3>
						<p>注意: 删除一个课程信息的同时, 会同时删除与课程相关所有教学数据信息. </p>
						<p>如果您确定<cfoutput>#rs_course.course_name#</cfoutput>在当前的教学安排中未使用, 并且在以后都不再使用该课程, 您可以在这里进行信息删除. 如果这些课程还安排有相关教学任务, 由于数据完整性维护的强制性要求, 这些相关信息会被同样删除. </p>
					
						<form id="formRemove" class="formWrapper Transparent" method="post" action="<cfoutput>#buildURL('courseRemoveDo')#</cfoutput>">
							<input type="hidden" name="InstituteID" value="<cfoutput>#rs_course.institute_id#</cfoutput>" />
							<input type="hidden" name="CourseID" value="<cfoutput>#rs_course.cid#</cfoutput>" />
							<div class="lable"><input class="button2" type="submit" value="删除课程" /></div>
						</form>
					</div>
					
				</div>
				
			</div>
		</li>
	</ul>
</div>


